package com.yoshino.iterator;

import java.util.Iterator;
import java.util.List;

/**
 * @author yoshino
 **/
public class InfoCollegeIterate implements Iterator {

    // 这里需要 Department 是以怎样的方式存放
    List<Department> departmentList;

    public InfoCollegeIterate(List<Department> departmentList) {
        this.departmentList = departmentList;
    }

    int index = -1; // 遍历的位置

    @Override
    public boolean hasNext() {
        if (index >= departmentList.size() - 1) {
            return false;
        }
        index++;
        return true;
    }

    @Override
    public Object next() {
        return departmentList.get(index);
    }

    @Override
    public void remove() {

    }
}
